package A1_4_Shopsystem;

import java.util.Date;

public class ShoppingSystemTest {
    public static void main(String[] args) {
        // 创建客户
        Customer customer = new Customer("张三", "13800138000", "北京市海淀区");

        // 创建商品
        Product laptop = new Product("笔记本电脑", 2.5, "高性能游戏本", 5999.0);
        Product mouse = new Product("无线鼠标", 0.2, "无线蓝牙鼠标", 199.0);

        // 创建订单
        Order order = new Order(customer);
        order.addOrderDetail(laptop, 1);
        order.addOrderDetail(mouse, 2);

        // 计算订单信息
        System.out.println("订单总金额: " + order.calculateTotalAmount());
        System.out.println("订单总重量: " + order.calculateTotalWeight());

        // 创建支付
        Payment payment = new Credit(order.calculateTotalAmount(), order,
                "1234-5678-9012-3456", "Visa", new Date());

        // 处理支付
        if (payment.processPayment()) {
            System.out.println("支付成功！订单状态: " + order.getStatus());
        }

        // 演示多态性：可以轻松切换支付方式
        Payment weixinPayment = new WeixinPay(order.calculateTotalAmount(), order, "wx123456");
        weixinPayment.processPayment();
    }
}
